﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Cloud.Model;
using Cloud.BLL;
using System.Configuration;
public partial class Three_Managerment_Problem_three_List_notic : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }
            if (!IsPostBack)
            {
                bind2();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }

    protected void AspNetPager2_PageChanged(object sender, EventArgs e)
    {
        try
        {
            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }
            bind2();
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }


    public void bind2()
    {
        try
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString);
            SqlCommand cmd = new SqlCommand("select * from notices order by id desc", connection);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            AspNetPager2.PageSize = 10;//设置分页大小 
            AspNetPager2.RecordCount = NoticesManager.FindAll().Count;//设置总数据条数 
            sda.Fill(ds, AspNetPager2.PageSize * (AspNetPager2.CurrentPageIndex - 1), AspNetPager2.PageSize, "notices");//固定不变的 
            repeater2.DataSource = ds.Tables["notices"];
            repeater2.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }

    //事件状态
    public string sjzt(int i)
    {
        String zts = "";
        if (i == 0)
        {
            zts = "待办理";
        }
        else if (i == 1)
        {
            zts = "办理中";
        }
        else if (i == 2)
        {
            zts = "已办理";
        }
        else if (i == 3)
        {
            zts = "已办结";
        }
        else if (i == 4)
        {
            zts = "直办";
        }
        return zts;

    }
    //protected void Unnamed_Click(object sender, EventArgs e)
    //{
    //    string path = Server.MapPath("~/files/");
    //    Notices activity = new Notices();
    //    if (this.file.HasFile)
    //    {
    //        file.PostedFile.SaveAs(path + file.FileName);
    //        activity.Files = "/files/" + file.FileName;
    //    }
    //    else
    //    {
    //        activity.Files = "";
    //    }

    //    activity.Cons = this.con.Value;
    //    activity.Relname = ((USER_INFO)Session["users"]).USER_NAME;
    //    activity.Rtime = DateTime.Now;
    //    activity.Title = this.title.Value;
    //    int i = NoticesManager.Save(activity);
    //    if (i > 0)
    //    {
    //        Response.Write("<script>alert('发布成功');location.href='index.aspx'</script>");
    //    }
    //}
}